<template>
  <view>
      <view class="cent-bo cent-box u-p-l-20 u-p-r-20">
        <view
          class="group-fac u-flex u-row-between u-col-center"
          v-for="(item,index) in jijinInfo"
          :key="item.id"
          @click="shangCLI(item.id,item.project_name)">
          <view class="right-content u-ellipsis-2">
            {{ item.project_name }}
          </view>
          <view class="right-content u-ellipsis-2">
            {{ item.gutpiao_text }}
          </view>
          <view class="right-content u-ellipsis-2">
            {{ item.user_text }}
          </view>
        </view>
      </view>
	  <u-loadmore :status="loadingType" class="u-p-b-80"></u-loadmore>
  </view>
</template>

<script>
	import http from '@/shopro/request/index.js';
export default {
  data() {
    return {
	    page: 1, //分页加载
	    loadingType: 'more', //加载更多状态
		jijinInfo:[]
	};
  },
  onLoad() {
    this.cityGupiao("refresh");
  },

  methods: {
    shangCLI(id,name) {
		let url = '',params={};
	    url = `/pages/index/city_path/shares_stock`;
	    params= {
		    id:id,
		    name:JSON.stringify(name)
	    };
		uni.setStorageSync("pageTitle",name)
		this.jump(url,params)
    },
	  jump(path, parmas) {
		  this.$Router.push({
			  path: path,
			  query: parmas
		  });
	  },
    cityGupiao(type = 'add', loading) {
	    if (type === 'add') {
		    if (this.loadingType === 'nomore') {
			    return;
		    }
		    this.loadingType = 'loading';
	    } else if (type === 'refresh') {
		    this.loadingType = 'loading';
		    this.page = 1;
		    this.projectData = [];
	    } else {
		    this.loadingType = 'more';
	    }
	    
	    let formData = {
		    page: this.page,
		    token: uni.getStorageSync('token')
	    };
      this.$new_http("lujing.cityGupiao",formData)
        .then((res) => {
	        let zhishiList = res.data.data;
	        this.page++;
	        this.jijinInfo = this.jijinInfo.concat(zhishiList);
	        this.loadingType = res.data.current_page >= res.data.last_page ? 'nomore' : 'more';
        })
        .catch((err) => {});
    },
  },
	//加载更多
	onReachBottom() {
		this.cityGupiao();
	}
};
</script>

<style lang="scss">
page {
  background-color: #f7f7f7;
}
.cent-box {
// width: 690rpx;
// height: 600rpx;
	background: #fff;
	border-radius: 20rpx;
	padding: 0 20rpx;
	margin: 20rpx;
  .group-fac{
	  border-bottom:2rpx solid #F0F0F0 ;
	  padding: 30rpx 0rpx;
	  width: 100%;
	  &:first-child{
	  }
	  &:last-child{
		  border-bottom:0rpx solid #F0F0F0 ;
	  }
	  .leftgroup{
		  .left-img{
			  width: 40rpx;
			  height: 40rpx;
			  margin-right: 20rpx;
		  }
	  }
	  .right-content{
		  width: 33vw;
		  .right{
			  text-align: right;
			  font-size: 24rpx;
			  color:#999;
		  }
		  .right-img{
			  width:22rpx;
			  height: 30rpx;
			  margin-right: 20rpx;
		  }
	  }
	  
  }
}

</style>
